﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        function showDateTime()
        {
            show();
            setInterval(show, 1000);
        }
        function show()
        {
            showDate();
            showTime();
        }
        function showDate()
        {
            var date = new Date();
            var weekday = date.getDay();
            document.getElementById("date").innerHTML = date.toLocaleDateString() +""+ getWeekDay(weekday);
        }
        function getWeekDay(weekday)
        {
            switch(weekday)
            {
                case 1: return "星期一";
                case 2: return "星期二";
                case 3: return "星期三";
                case 4: return "星期四";
                case 5: return "星期五";
                case 6: return "星期六";
                case 7: return "星期七";

            }
        }
            function showTime()
            {
                var time = new Date();
               var hour= time.getHours();
                var min = time.getMinutes();
                var sec = time.getSeconds();
                document.getElementById("time").innerHTML = getTime(hour) + '<img src ="images/dot.png"/>' + getTime(min) + '<img src ="images/dot.png"/>' + getTime(sec);
            }
            function getTime(num)
            {
                var n = parseInt(num)
                var str = "";
                var result = "";
                if (n < 10) {
                    str = "0" + num;
                } else {
                    str = "" + num;
                }
                for (var i = 0; i < str.length ; i++)
                {
                    result += '<img src="images/' + str[i] + '.png "/>';
                    

                }
                return result;
            }

 
    </script>
</head>
<body onload="showDateTime();">
    <h1 id="date"></h1>
    <div id="time">
        
    </div>
</body>
</html>
